﻿namespace Probel.NDoctor.Statistics.UnitTests
{
    using System.Linq;

    using NUnit.Framework;

    [TestFixture]
    public abstract class BaseCollectionQuery
    {
        #region Fields

        private readonly ICollectionQuery CollectionQuery;
        private readonly IFactory Factory;

        #endregion Fields

        #region Constructors

        public BaseCollectionQuery(IFactory factory)
        {
            this.Factory = factory;
            this.CollectionQuery = this.Factory.Collections();
        }

        #endregion Constructors

        #region Methods

        [Test]
        public void Retrieve_AllStatistics_10Statistics()
        {
            var stat = this.CollectionQuery.GetAllStatistics();
            Assert.AreEqual(10, stat.Count());
        }

        [Test]
        public void Retrieve_AllUsers_6Users()
        {
            var users = this.CollectionQuery.GetAllApplications();
            Assert.AreEqual(6, users.Count());
        }

        [Test]
        public void Retrieve_Bottlenecks_5AreReturned()
        {
            var bottlenecks = this.CollectionQuery.GetBottlenecksArray();
            Assert.AreEqual(5, bottlenecks.Count());
        }

        #endregion Methods
    }
}